// logs.js
const util = require('../../utils/util.js')

Page({
  data: {
    logs: [],
    array: [
      { name: '1', checked: false },
      { name: '2', checked: true },
      { name: '3', checked: true },
      { name: '4', checked: true },
      { name: '5', checked: true },
    ],
    items: [
      { name: '1', checked: false },
      { name: '2', checked: true },
      { name: '3', checked: true },
      { name: '4', checked: true },
      { name: '5', checked: true },
    ],
    rangeArray: [
      [
        { name: '185', value: 185 },
        { name: '175', value: 185 },
        { name: '165', value: 185 },
        { name: '155', value: 185 },
        { name: '145', value: 185 },
      ],
      [
        { name: '80kg', value: 185 },
        { name: '70kg', value: 185 },
        { name: '60kg', value: 185 },
        { name: '55kg', value: 185 },
        { name: '50kg', value: 185 },
      ]
    ],
    rangeValueArray: []
  },
  onLoad() {
    this.setData({
      logs: (wx.getStorageSync('logs') || []).map(log => {
        return {
          date: util.formatTime(new Date(log)),
          timeStamp: log
        }
      })
    })
    wx.enableAlertBeforeUnload({
      message: '确定返回？',
      success: res => {
        console.log(res)
      },
      complete: res => {
        console.log(res)
      }
    })
  },
  bindChange (e) {
    console.log(e)
  },
  bindgetphonenumber (e) {
    console.log(e)
  },
  bindGetUserInfo (e) {
    console.log(e.detail)
  },
  bindPickerChange (e) {
    console.log(e)
    this.setData({
      rangeValueArray: e.detail.value
    })
  },
})
